<template>
    <van-search v-model="values" show-action label="地址" :placeholder="pla" @search="onSearch">
        <template #action>
            <div @click="onClickButton">搜索</div>
        </template>
    </van-search>
    <van-cell-group>
        <van-cell v-for="item in searchApiData" :title="item.goods_name" />
    </van-cell-group>
</template>

<script setup>
import { useRouter } from 'vue-router';
import { defineProps, ref, watch } from 'vue';
const router = useRouter()
const onSearch = () => {
    router.push('/search')
}
const props = defineProps({
    pla: ''
})
import { searchApi } from '@/api/api';
const values = ref('')
let searchApiData = ref([])
watch(values, val => {
    console.log(val);
    searchApi(val).then(res => {
        console.log(res);
          searchApiData.value=res.data.message
    })

})

</script>

<style lang="scss" scoped></style>